
import java.util.Scanner;

class SinhVien{
    String name;
    String mssv;
    double diem;
    
    public void hienThi(){
        System.out.println("Ten :"+this.name);
        System.out.println("Ten :"+this.mssv);
        System.out.println("Ten :"+this.diem);
    }
}

public class bai1{

	public static void main(String [] args){
            Scanner scanln= new Scanner(System.in);
            int n,a=0,b=0 ;           
            double sum=0; 
            if((args==null)||(args.length!=1))
			System.out.println("Khong thoa man");
            else{
                    n=Integer.parseInt(args[0]);                   
                    SinhVien[] ngoc= new SinhVien[n];
                    for(int i=0;i<n;i++){
                        ngoc[i]= new SinhVien();
                        System.out.println("Nhap thong tin sinh vien "+(i+1));    
                        System.out.print("Name:");
                        ngoc[i].name =scanln.nextLine();  
                        System.out.print("MSSV:");
                        ngoc[i].mssv = scanln.nextLine();   
                        System.out.print("Diem:");
                        ngoc[i].diem =Double.parseDouble(scanln.nextLine());
                        sum+=ngoc[i].diem;
                        
                    }
                    double min=ngoc[0].diem,max=ngoc[0].diem,dem=0;
                    for(int i=1;i<n;i++){
                        
                        if(ngoc[i].diem<min){
                            a=i;
                            min=ngoc[i].diem;
                        }
                        if(ngoc[i].diem>max){
                            b=i;
                            max=ngoc[i].diem;
                        }
                        
                    }
                    System.out.format("\n%-23s %-12s %-10s ","NAME","MSSV","DIEM"); 
                    for(int i=0;i<n;i++)                        
                        System.out.format("\n%-23s %-12s %-10s ",ngoc[i].name,ngoc[i].mssv,ngoc[i].diem); 
                    
                    System.out.println();
                    System.out.println("Sinh vien diem cao nhat la  :"+ngoc[b].name);
                    System.out.println("Sinh vien diem thap nhat la :"+ngoc[a].name);
                    int j=0;
                    for(int i=0;i<n;i++)
                        if(ngoc[i].diem>=4)    j++ ;
                    System.out.println("So SV qua la:"+j);
                    System.out.println("TB diem la "+sum/(double)n);
                            
              }
	}
}